<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">信用卡信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-fw fa-edit" update="@form"
                                         rendered="#{loanNewCreditCardInfoBean.isView()}"
                                         actionListener="#{loanNewCreditCardInfoBean.changeStatusToEdit()}"/>

                        <p:commandButton value="保存" icon="fa fa-save" update="@form"
                                         rendered="#{loanNewCreditCardInfoBean.isEdit()}"
                                         actionListener="#{loanNewCreditCardInfoBean.saveInfo()}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="card ui-g-12">
                    <div class="ui-g">
                        <div class="ui-g-12"><h3><b>信用卡信息</b></h3></div>
                        <div class="ui-g-2">
                            <p:outputLabel value="信用卡名称"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.cardName}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="信用卡描述1"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.loanNewCreditCardInfoVo.detailOne}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="信用卡描述2"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.loanNewCreditCardInfoVo.detailTwo}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="信用卡标签"/>
                        </div>
                        <div class="ui-g-4">
                            <p:chips value="#{loanNewCreditCardInfoBean.loanNewCreditCardInfoVo.cardLabelList}"
                                     disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="列表页返利标签"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.listRebateLabel}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="详情页返利标签"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.detailRebateLabel}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="副标题"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.subTitle}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="返利金额"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputNumber value="#{loanNewCreditCardInfoBean.$.rebateAmount}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="银行进度"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu filter="true" filterMatchMode="startsWith"  value="#{loanNewCreditCardInfoBean.$.progressId}"
                                             disabled="#{loanNewCreditCardInfoBean.isView()}">
                                <f:selectItem itemLabel="--请选择--" itemValue=""/>
                                <f:selectItems value="#{loanNewCreditCardInfoBean.loanNewCreditCardProgressList}" var="cardProgress"
                                               itemLabel="#{cardProgress.bankName}" itemValue="#{cardProgress.id}"/>
                            </p:selectOneMenu>

                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="等级"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.degree}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="发卡组织"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.cardOrganization}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="免息期限"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.freeDeadline}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="积分规则"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.integralRule}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="申请条件"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.applyCondition}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="跳转链接"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.redirectUrl}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="初始申请人数"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputNumber value="#{loanNewCreditCardInfoBean.$.initApplyCount}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="成功申请人数"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputNumber value="#{loanNewCreditCardInfoBean.$.successApplyCount}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="展示标签"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.showLabel}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="跳转提示文案"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.redirectTipLabel}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="备注"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{loanNewCreditCardInfoBean.$.remark}"
                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="活动缩略图"/>
                        </div>
                        <div class="ui-g-3">
                            <p:graphicImage id="logoImage" value="#{loanNewCreditCardInfoBean.$.logo}"
                                            width="80px"/>
                        </div>
                        <div class="ui-g-1">
                            <p:fileUpload fileUploadListener="#{loanNewCreditCardInfoBean.uploadLogo}"
                                          mode="advanced"
                                          update="logoImage"
                                          auto="true" sizeLimit="#{constants:get('UPLOAD_FILE_SIZE')}"
                                          allowTypes="/(\.|\/)(#{constants:get('UPLOAD_FILE_SUFFIX')})$/"
                                          label="上传"
                                          invalidFileMessage="不支持上传文件类型"
                                          invalidSizeMessage="文件过大"
                                          disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                        </div>

                        <p:outputPanel id="fpan" styleClass="ui-g-12 ui-g-nopad">
                        <c:forEach items="#{loanNewCreditCardInfoBean.loanNewCreditCardInfoVo.cardList}" var="info" varStatus="status">
                            <div class="ui-g-12 ui-g-nopad">
                                <div class="ui-g-2">
                                    <p:outputLabel value="专属特权"/>
                                </div>
                                <div class="ui-g-4">
                                    <p:selectOneMenu value="#{info.logo}" disabled="#{loanNewCreditCardInfoBean.isView()}">
                                        <f:selectItem itemLabel="金钱有关" itemValue="https://img.tuanzidai.cn/banana-card-application-details/section_01.png" />
                                        <f:selectItem itemLabel="健康有关" itemValue="https://img.tuanzidai.cn/banana-card-application-details/section_04.png" />
                                        <f:selectItem itemLabel="安全有关" itemValue="https://img.tuanzidai.cn/banana-card-application-details/section_02.png" />
                                        <f:selectItem itemLabel="礼物有关" itemValue="https://img.tuanzidai.cn/banana-card-application-details/section_03.png" />
                                    </p:selectOneMenu>
                                </div>

                                <div class="ui-g-5">
                                    <p:inputText value="#{info.desc}"
                                                 disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                                </div>
                                <c:if test="#{status.count ==1}">
                                    <div class="ui-g-1">
                                        <p:commandButton icon="fa fa-plus"  update="fpan" process="fpan"
                                                         actionListener="#{loanNewCreditCardInfoBean.add()}"
                                                         disabled="#{loanNewCreditCardInfoBean.isView()}"/>
                                    </div>
                                </c:if>
                            </div>
                        </c:forEach>
                        </p:outputPanel>
                    </div>
                </div>
            </div>

        </h:form>
    </ui:define>
</ui:composition>
